package com.android.panballgame;

import android.content.Context;
import android.content.Intent;
import android.database.sqlite.SQLiteDatabase;
import android.view.View;

public class PBEngine {
	//게임에서 사용될 상수값
	public static final int GAME_THREAD_DELAY = 1500;//시작이미지에서 메뉴 뜰 때까지 걸리는 시간
	public static final int MENU_BUTTON_ALPHA = 0;//start, exit 버튼의 투명도 설정
	public static final boolean HAPTIC_BUTTON_FEEDBACK = true;
	public static final int MUSIC = R.raw.bgm;
	public static final int R_VOLUME = 60;//초기 볼륨값
	public static final int L_VOLUME = 60;
	public static final boolean LOOP_BACKGROUND_MUSIC = true;//배경음악 반복 설정
	
	public static final int GAME_THREAD_FPS_SLEEP = (1000/60);
	public static Context context, mcontext;//음악을 재생할 현재 컨텍스트
	public static Thread musicThread;
	public static final int BACKGROUND_LAYER_ONE = R.drawable.img_back1;
	public static final int BACKGROUND_LAYER_TWO = R.drawable.img_back2;
	public static final int BACKGROUND_LAYER_THREE = R.drawable.img_back3;
	public static final int PLAYER_BALL = R.drawable.img_ball;
	public static final int PLAYER_COIN = R.drawable.img_coin;
	public static final int PLAYER_CLOCK = R.drawable.img_clock;
	public static final int PLAYER_SPEED = R.drawable.img_speed;
	
	//게임변수
	public static float ballx, bally;
	public static int coinLoc;
	
	public static int[] drawcoin = new int[9];
	public static int itemLoc = 0;
	public static int item1 = 0, item2 = 0;
	
	public static final int PAUSE_DIALOG  = 0, NOTICE_DIALOG = 1;
	public static final int CLEAR = 1;
	public static int STATUS = 0;
	public static boolean WAIT = false, HOLE = false, MINUS_TIME = false;
	public static int level = 0, remain = 0, extend_time = 0, dbtime =0;	//남은 과제 수
	public static long time = 0, time2 = 0, time_level1 = 0, time_level2 = 0, time_level3 = 0, temptime = 0;//순수 각 래밸에서 걸린 시간
	
	public static int isSound = 1, isMusic = 1;// 배경음악
	public static int useDb = 0, isDb = 0;//게임 실행시 데이터를 불러올거다, 이전 데이터가 있다
	public static SQLiteDatabase db;
	public static final String MAIN_TABLE = "gamedata", LEVEL_TABLE = "level";
	
	//게임을 종료한다.
	public boolean onExit(View v){
		try
		{
			Intent bgmusic = new Intent(context, PBMusic.class);
			context.stopService(bgmusic);
			PBMusic.isRunning = false;
			
			return true;
			
		}catch(Exception e){
			return false;
		}
	}

public boolean onExit(){
	try
	{
		Intent bgmusic = new Intent(context, PBMusic.class);
		context.stopService(bgmusic);
		PBMusic.isRunning = false;
		return true;
	}catch(Exception e){
		return false;
	}
}
}
